import request from '@/utils/request'

// 1、查询菜单嵌套集合
export const GetNestedMenus = () => {
  return request({
    url: `/admin/system/menu/listNestedMenus`,
    method: 'GET',
  })
}
//2、删除指定菜单
export const DeleteMenu = id => {
  return request({
    url: `/admin/system/menu/delete/${id}`,
    method: 'DELETE',
  })
}
//3、新增菜单
export const SaveMenu = data => {
  return request({
    url: `/admin/system/menu/save`,
    method: 'POST',
    data,
  })
}

//4、查询指定菜单
export const GetMenuById = id => {
  return request({
    url: `/admin/system/menu/getById/${id}`,
    method: 'GET',
  })
}
//5、更新菜单
export const UpdateMenu = data => {
  return request({
    url: `/admin/system/menu/update`,
    method: 'PUT',
    data,
  })
}

//6、查询所有菜单和已分配的菜单id集合
export const GetMenusAndAssignedMenuIds = roleId => {
  return request({
    url: `/admin/system/menu/listMenusAndAssignedMenuId/${roleId}`,
    method: 'GET',
  })
}
